'use client'
import { useSearchParams } from 'next/navigation'
import OneMoreStep from './oneMoreStep'
import NormalForm from './normalForm'
// import {useContext} from "use-context-selector";
// import {useEffect} from "react";
// import { login } from '@/service/common'
// import Toast from '@/app/components/base/toast'
// import I18NContext from '@/context/i18n'
import {useRouter} from "next/navigation";
// import {useTranslation} from "react-i18next";
const SignIn = () => {
  // const { t } = useTranslation()
  // const { locale } = useContext(I18NContext)
  const router = useRouter()
  // const handleEmailPasswordLogin = async () => {
  //   const loginData: Record<string, any> = {
  //     email:'327464319@qq.com',
  //     password:'xys08302',
  //     language: locale,
  //     remember_me: true,
  //   }
  //   console.log(loginData,'loginData')
  //   const res = await login({
  //     url: '/login',
  //     body: loginData,
  //   })
  //   if (res.result === 'success') {
  //     console.log(res,'success')
  //     localStorage.setItem('console_token', res.data.access_token)
  //     localStorage.setItem('refresh_token', res.data.refresh_token)
  //     router.replace('/apps')
  //   }
  //   else {
  //     Toast.notify({
  //       type: 'error',
  //       message: t('login.error.registrationNotAllowed'),
  //     })
  //
  //   }
  // }
  // useEffect( () => {
  //   console.log('进入页面，开始登录...');
  //   handleEmailPasswordLogin()
  // },[])
  const searchParams = useSearchParams()
  const step = searchParams.get('step')
  if (step === 'next')
    return <OneMoreStep />
  return <NormalForm />
}

export default SignIn
